<template>
    <!-- 我的班级 -->
    <div class="myClassBox">
        <x-header :left-options="{showBack: true,backText:'我的班级'}" class="headerBox"></x-header>
        <!-- 筛选 -->
        <div class="resTitleBox">
            <div class="resTitle_left">全部班级</div>
            <div class="resTitle_right" >
                <img src="../assets/images/search30.png" style="display: none"/>
                <img src="../assets/images/filtrate6.png" style="display: none" @click="sortPop = !sortPop"/>
            </div>

            <!-- 筛选弹框 -->
            <div class="sorts" v-if="sortPop == true" style="display: none">
                <div class="sortList">
                    <img src="../assets/images/icon_weijian2x.png"/>文件
                </div>
                <div class="sortList">
                    <img src="../assets/images/icon_img2x.png"/>照片
                </div>
                <div class="sortList">
                    <img src="../assets/images/icon_viedio2x.png"/>视频
                </div>
            </div>

            <!-- 上传弹框 -->
            <div class="sorts" style="right: 17px;" v-if="upLoadPop == true">
                <div class="sortList">
                    <img src="../assets/images/icon_scwj2x.png"/>上传文件
                </div>
                <div class="sortList">
                    <img src="../assets/images/icon_sctp2x.png"/>上传照片
                </div>
                <div class="sortList">
                    <img src="../assets/images/icon_scsp2x.png"/>上传视频
                </div>
            </div>
        </div>
        <div v-for="(item, index) in classList" class="classBox">
            <router-link :to="{name:'classCourse',query:{id:item.classRoomId}}">

                <div class="classInfos">
                    <img :src="item.largePicture"/>
                    <div class="classInfo">
                        <div class="fs_26">
                            {{item.title}}
                            <span
                                    :class="item.stateColor? 'color_orange2':'color_blue'"
                            >({{item.state? '进行中':'已完结'}})</span>
                        </div>
                        <div class="fs_26">班主任：{{item.headTeacherName}}</div>
                        <div class="fs_26 color_orange2">总成员：{{item.studentsNum}}人</div>
                    </div>
                </div>
                <div class="classItem">
                    <div>课程：{{item.coursesNum}}</div>
                    <div>话题：{{item.topicNum}}</div>
                    <div>笔记：{{item.noteNum}}</div>
                </div>
                <div class="bottomLine"></div>
            </router-link>
        </div>
    </div>
</template>

<script>
    import {XHeader} from "vux";
    import {MyClass} from '@/api/index/study';
    import store from "../store/store";

    export default {
        components: {
            XHeader
        },
        data() {
            return {
                upLoadPop: false,
                sortPop: false,
                classList: [
                    // {
                    //     classImg: require('../assets/images/head06.png'),
                    //     className: '一年级英语',
                    //     classNum: '一班',
                    //     stateColor: true,
                    //     state: true,
                    //     teacher: '成然',
                    //     num: '28',
                    //     course: '4',
                    //     topic: '2',
                    //     note: '4'
                    // },
                    // {
                    //     classImg: require('../assets/images/head06.png'),
                    //     className: '一年级英语',
                    //     classNum: '一班',
                    //     stateColor: false,
                    //     state: false,
                    //     teacher: '成然',
                    //     num: '28',
                    //     course: '4',
                    //     topic: '2',
                    //     note: '4'
                    // },
                    // {
                    //     classImg: require('../assets/images/head06.png'),
                    //     className: '一年级英语',
                    //     classNum: '一班',
                    //     stateColor: true,
                    //     state: true,
                    //     teacher: '成然',
                    //     num: '28',
                    //     course: '4',
                    //     topic: '2',
                    //     note: '4'
                    // },
                    // {
                    //     classImg: require('../assets/images/head06.png'),
                    //     className: '一年级英语',
                    //     classNum: '一班',
                    //     stateColor: false,
                    //     state: false,
                    //     teacher: '成然',
                    //     num: '28',
                    //     course: '4',
                    //     topic: '2',
                    //     note: '4'
                    // }
                ],
            }
        },
        created() {
            MyClass(this.$store.state.user.id).then(res => {
                console.log(res.data.data);
                this.classList = res.data.data.list;
            }).catch(err => {
                console.log(err)
            });


        },
    }
</script>

<style lang="less" scoped>
    .myClassBox {
        // 头部导航
        /deep/ .headerBox {
            background-color: #fff;
            border-bottom: 1px solid #eee;

            .vux-header-left {
                left: 24px;

                .vux-header-back {
                    color: #000;
                }

                .left-arrow:before {
                    border-color: #000;
                }
            }
        }

        // 筛选
        .resTitleBox {
            background-color: #f8f9fa;
            width: 100%;
            height: 100px;
            padding: 0 26px;
            display: flex;
            justify-content: center;
            align-items: center;
            box-sizing: border-box;
            position: relative;

            .resTitle_left {
                font-size: 30px;
            }

            .resTitle_right {
                margin-left: auto;

                img {
                    width: 32px;
                    height: 32px;
                    margin: 0 20px;
                }
            }

            .sorts {
                position: absolute;
                top: 100px;
                right: 30px;
                background-color: #fff;
                border-radius: 10px;
                box-shadow: 0 0 10px 5px #ddd;
                z-index: 99;

                &::before {
                    content: '';
                    width: 0px;
                    height: 0px;
                    border-left: 10px solid transparent;
                    border-right: 10px solid transparent;
                    border-bottom: 10px solid #fff;
                    position: absolute;
                    top: -10px;
                    right: 20px;
                }

                .sortList {
                    padding: 15px 30px;
                    border-bottom: 1px solid #eee;

                    img {
                        width: 42px;
                        height: 40px;
                        vertical-align: middle;
                        margin-right: 20px;
                    }
                }
            }
        }

        /* 班级 */

        .classBox {
            .classInfos {
                margin: 30px;
                display: flex;
            }

            .classInfos img {
                width: 135px;
                height: 135px;
                border-radius: 50%;
            }

            .classInfo {
                display: flex;
                flex-direction: column;
                justify-content: space-between;
                padding: 5px 0;
                margin-left: 40px;
            }

            .classItem {
                display: flex;
                margin-bottom: 20px;
            }

            .classItem div {
                flex: 1;
                text-align: center;
                font-size: 28px;
            }

            .classItem div:not(:first-child) {
                border-left: 1px solid #f1f2f3;
            }

            .bottomLine {
                border-top: 2px solid #eee;
                border-bottom: 20px solid #f8f9fa;
            }

            .color_orange2 {
                color: #fda203;
            }

            .color_blue {
                color: #2873f3;
            }
        }
    }
</style>